<?php
require_once dirname(dirname(__FILE__)) . '/shared/config/config.php';
require_once DOCUMENT_ROOT . DIR_SHARED_API . 'api_affiliate.php';
require_once DOCUMENT_ROOT . DIR_INCLUDE . 'html_generator.php';

?>
            
                <div class="col-md-12">
                    <div class="service-wrapper">
                        <table class="table">
                            <tr>
                                <th class="text-center">ID</th>
                                <th class="text-center">Username</th>
                                <th class="text-center">Question 1</th>
                                <th class="text-center">Question 2</th>
                                <th class="text-center">Question 3</th>
                                <th class="text-center">Question 4</th>
                                <th class="text-center">Question 5</th>
                                <th class="text-center" colspan="3">Action</th>
                            </tr>
                            <?php
                            $list = api_affiliate::get_all_affiliate_form_need_approve(); 
                            if (empty($list) || count($list) == 0) {
                                echo "<tr><td colspan='8'>Empty.</td></tr>";
                            } else {
                                foreach ($list as $item) {
                                ?>
                                <tr>
                                    <td><?php echo $item['id']; ?></td>
                                    <td><?php echo $item['username']; ?></td>
                                    <td><?php echo $item['question_1']; ?></td>
                                    <td><?php echo $item['question_2']; ?></td>
                                    <td><?php echo $item['question_3']; ?></td>
                                    <td><?php echo $item['question_4']; ?></td>
                                    <td><?php echo $item['question_5']; ?></td>
                                    <td>
                                        <img onclick="affiliateApprove.approveForm(<?php echo $item['id']; ?>);" class="ts-action-icon center-block" src="<?php echo LINK_ROOT . DIR_SHARED_LAYOUT_IMAGES_ICONS . 'accept.png' ?>" alt="accept">
                                    </td>
                                    <td>
                                        <img onclick="affiliateApprove.viewForm('<?php echo $item['id']; ?>')" data-toggle="modal" data-target="#myModal" class="ts-action-icon center-block" src="<?php echo LINK_ROOT . DIR_SHARED_LAYOUT_IMAGES_ICONS . 'view.png' ?>" alt="view">
                                    </td>
                                    <td>
                                        <img onclick="affiliateApprove.deleteForm('<?php echo $item['id']; ?>')" class="ts-action-icon center-block" src="<?php echo LINK_ROOT . DIR_SHARED_LAYOUT_IMAGES_ICONS . 'delete.png' ?>" alt="delete">
                                    </td>
                                </tr>
                                <?php
                                }
                            }
                            ?>
                        </table>
                    </div>
                </div>
